package com.example.group_20.utils;

import java.sql.Date;
import java.time.LocalDate;

/**
 * @author: 栋
 * @data: 2023/8/23
 * @descriptions:
 */
public class TLogUtils {
    public static String getId(String lastId){
        StringBuilder id=new StringBuilder("T");
        Date date= Date.valueOf(LocalDate.now());
        String s = date.toString();
        String[] split = s.split("-");
        for (String s1 : split) {
            id.append(s1);
        }
        Integer end=1;
        if(lastId.length()!=0){
            if(lastId.startsWith(id.toString())){
                String sub=lastId.substring(9,14);
                end=Integer.valueOf(sub)+1;
            }
        }
        String endprefix = String.format("%05d",end);
        id.append(endprefix);
        String ids = id.toString();
        return ids;


    }
}
